Component({
  properties: {},
  data: {
    visible: false,
    resolve: null,
    reject: null,
  },
  methods: {
    open() {
      return new Promise(((resolve, reject) => {
        this.setData({
          resolve: resolve,
          reject: reject,
          visible: true
        });
      }))
    },
    handleStop() {
      return true;
    },
    handleClose() {
      this.setData({visible: false, resolve: null, reject: null});
    },
    handleSelect(e) {
      let deliveryType = e.currentTarget.dataset.type;
      let resolve = this.data.resolve
      if (this.data.resolve) {
        resolve(deliveryType);
      }
      this.setData({visible: false, resolve: null, reject: null})
    },

  }
});
